import request from '@/utils/request';

// 查询库区列表
export function listArea(query: Record<string, any>) {
  return request({
    url: '/wms/area/list',
    method: 'get',
    params: query
  })
}

// 查询库区详细
export function getArea(areaId: string | number) {
  return request({
    url: '/wms/area/' + areaId,
    method: 'get'
  })
}

// 新增库区
export function addArea(data: Record<string, any>) {
  return request({
    url: '/wms/area',
    method: 'post',
    data: data
  })
}

// 修改库区
export function updateArea(data: Record<string, any>) {
  return request({
    url: '/wms/area',
    method: 'put',
    data: data
  })
}

// 删除库区
export function delArea(areaId: string | number | string[]) {
  const ids = Array.isArray(areaId) ? areaId.join(',') : areaId;
  return request({
    url: '/wms/area/' + ids,
    method: 'delete'
  })
}

// 导出库区
export function exportArea(query: Record<string, any>) {
  return request({
    url: '/wms/area/export',
    method: 'post',
    data: query
  })
}

// 根据仓库ID获取库区列表
export function getAreasByWarehouse(warehouseId: string | number) {
  return request({
    url: '/wms/area/warehouse/' + warehouseId,
    method: 'get'
  })
}

// 获取库区下拉列表
export function getAreaOptions() {
  return request({
    url: '/wms/area/listNoPage',
    method: 'get'
  })
}




